package action;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.*;

import org.apache.struts.action.*;
import org.apache.struts.actions.DispatchAction;

import dao.UserDAO;
import dao.UserSnapshotDAO;

import bean.Album;
import bean.User;
import bean.UserSnapshot;

public class ImageAction extends DispatchAction {
	// list all of the album
	public ActionForward browse(
			ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response){
		return null;
	}
	
	public ActionForward view(
			ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response){
		
		return null;		
	}
	
	public ActionForward delete(
			ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response){
		
		UserSnapshotDAO userSnapshotDAO=new UserSnapshotDAO();
		int snapshotId=Integer.parseInt( request.getParameter("snapshotid"));
		UserSnapshot userSnapshot=userSnapshotDAO.findById(snapshotId);
		
		if(userSnapshot!=null){
			
			userSnapshotDAO.delete(userSnapshot);
		}
		
		return mapping.findForward("success");
	}
}
